package com.yw.common.core.test;

import java.util.List;
import java.util.Map;

import com.yw.common.core.entity.StringParam;
import com.yw.common.core.fs.config.ConfigReaderFactory;
import com.yw.common.core.fs.config.IConfigReader;
import com.yw.common.core.fs.config.exception.ConfigReaderException;
import com.yw.common.core.util.ConfigUtil;

/**
 * 测试配置文件读取
 * @author aoshiguchen
 * @time 2015-08-21	
 */

public class Config {

	public static void main(String[] args) throws ConfigReaderException {
		
		//test1();
		//test2();
		//test3();
		//test4();
		test5();
	}
	
	public static void test1() throws ConfigReaderException{
		IConfigReader configReader = ConfigReaderFactory.createPropConfigReader();
		
		Map<String,String> config = configReader.readAll();
		
		for(String key : config.keySet()){
			System.out.println(key + " : " + config.get(key));
		}
	}
	
	public static void test2() throws ConfigReaderException{
		IConfigReader configReader = ConfigUtil.getConfigReader();
		
		Map<String,String> config = configReader.readAll();
		
		for(String key : config.keySet()){
			System.out.println(key + " : " + config.get(key));
		}
	}
	
	public static void test3(){
		Map<String,String> config = ConfigUtil.readAllToStringMap();
		
		for(String key : config.keySet()){
			System.out.println(key + " : " + config.get(key));
		}
	}
	
	public static void test4(){
		List<StringParam> params = ConfigUtil.readAllToParamList();
		
		System.out.println(params);
	}
	
	public static void test5(){
		System.out.println(ConfigUtil.getDbConfig());
	}
	
}
